package com.hiss.basic.starter.websocket.publisher;

import cn.hutool.extra.spring.SpringUtil;
import com.hiss.basic.starter.websocket.constant.WebSocketConstant;
import com.hiss.basic.starter.websocket.model.MessageModel;
import org.springframework.data.redis.core.RedisTemplate;

public class WebSocketMessagePublisher {

    private static final RedisTemplate<String, Object> redisTemplate = SpringUtil.getBean("redisTemplate", RedisTemplate.class);

    public static void publish(MessageModel message) {
        redisTemplate.convertAndSend(WebSocketConstant.WEBSOCKET_QUEUE_TOPIC, message);
    }
}
